/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86186
 * Date: 2023-09-30
 * Time: 15:09
 */
public class Test2 {
    private int value;

    private int number = 0;

    public void add(int money) {
        int oldNumber = number;
        if (CAS(number, oldNumber, oldNumber + 1)) {
            value += money;
        }
    }
}
